package cn.itsource.api.fallback;

import cn.itsource.api.openfeign.ILoginOpenFeignClient;
import cn.itsource.constants.ErrorCode;
import cn.itsource.pojo.ro.LoginRo;
import cn.itsource.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LoginFallbackFactory implements FallbackFactory<ILoginOpenFeignClient> {
    @Override
    public ILoginOpenFeignClient create(Throwable cause) {
        return new ILoginOpenFeignClient() {
            @Override
            public JSONResult createLogin(LoginRo login) {
                return JSONResult.error(ErrorCode.SERVICE_REQUEST_ERROR);
            }
        };
    }
}
